#coding:utf-8

import Const
import logging
import logging.config
logging.config.fileConfig(Const.logCfgPath)
logger = logging.getLogger("example01")


# 子串存在
def isSubstring3(child,father):
    return child in father

def findOnce(search,origin,way='L'):
    if way=='L':                      # 从左往右查找，返回从左往右的序号
       index = origin.find(search)
    elif way=='R':
       index = origin.rfind(search)   # 从右往左查找, 注意 返回的序号依然是从左往右
    return index   # index order is from left to right


def findSubstrings(substrings,destString):
    res =  map(lambda x:str([destString.index(x),x]),filter(lambda x:x in destString,substrings))
    if res:
        return ','.join(list(res))

